﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;


namespace DataTransferObject
{
    public class MarketingPaymentMaster : NotifyPropertyChangeObject
    {

        private int marketingPaymentID;

        private string referenceCode;
        private string paymentMachanics;

        private int customerID;
        private string customerDescription;
        private int marketingProgramID;
        private string marketingProgramReference;
        private int marketingIncentiveID;
        private string marketingIncentivePeriod;
        private int marketingPaymentTermID;
        private string marketingPaymentTermDescription;

        private int requestedEmployeeID;
        private int notedEmployeeID;
        private int approvedEmployeeID;

        private DateTime paymentDate;
        private DateTime entryDate;

        private string remarks;



        public MarketingPaymentMaster()
        {
            GlobalDefaultValue.Apply(this);

            this.PaymentDate = DateTime.Today;
            this.EntryDate = DateTime.Today;
        }

        public MarketingPaymentMaster ShallowClone()
        {
            return (MarketingPaymentMaster)this.MemberwiseClone();
        }

        #region Properties


        //[DefaultValue(-1)]
        public int MarketingPaymentID
        {
            get { return this.marketingPaymentID; }
            set { ApplyPropertyChange<MarketingPaymentMaster, int>(ref this.marketingPaymentID, o => o.MarketingPaymentID, value); }
        }


        [DefaultValue("")]
        public string ReferenceCode
        {
            get { return this.referenceCode; }
            set { ApplyPropertyChange<MarketingPaymentMaster, string>(ref this.referenceCode, o => o.ReferenceCode, value.Trim()); }
        }


        [DefaultValue("")]
        public string PaymentMachanics
        {
            get { return this.paymentMachanics; }
            set { ApplyPropertyChange<MarketingPaymentMaster, string>(ref this.paymentMachanics, o => o.PaymentMachanics, value); }
        }


        [DefaultValue("")]
        public string Remarks
        {
            get { return this.remarks; }
            set { ApplyPropertyChange<MarketingPaymentMaster, string>(ref this.remarks, o => o.Remarks, value); }
        }


        [DefaultValue(0)]
        public int CustomerID
        {
            get { return this.customerID; }
            set { ApplyPropertyChange<MarketingPaymentMaster, int>(ref this.customerID, o => o.CustomerID, value); }
        }

        [DefaultValue("")]
        public string CustomerDescription
        {
            get { return this.customerDescription; }
            set { ApplyPropertyChange<MarketingPaymentMaster, string>(ref this.customerDescription, o => o.CustomerDescription, value); }
        }

        [DefaultValue(0)]
        public int MarketingProgramID
        {
            get { return this.marketingProgramID; }
            set { ApplyPropertyChange<MarketingPaymentMaster, int>(ref this.marketingProgramID, o => o.MarketingProgramID, value); }
        }

        [DefaultValue("")]
        public string MarketingProgramReference
        {
            get { return this.marketingProgramReference; }
            set { ApplyPropertyChange<MarketingPaymentMaster, string>(ref this.marketingProgramReference, o => o.MarketingProgramReference, value); }
        }

        [DefaultValue(0)]
        public int MarketingIncentiveID
        {
            get { return this.marketingIncentiveID; }
            set { ApplyPropertyChange<MarketingPaymentMaster, int>(ref this.marketingIncentiveID, o => o.MarketingIncentiveID, value); }
        }

        [DefaultValue("")]
        public string MarketingIncentivePeriod
        {
            get { return this.marketingIncentivePeriod; }
            set { ApplyPropertyChange<MarketingPaymentMaster, string>(ref this.marketingIncentivePeriod, o => o.MarketingIncentivePeriod, value); }
        }


        [DefaultValue(0)]
        public int MarketingPaymentTermID
        {
            get { return this.marketingPaymentTermID; }
            set { ApplyPropertyChange<MarketingPaymentMaster, int>(ref this.marketingPaymentTermID, o => o.MarketingPaymentTermID, value); }
        }

        [DefaultValue("")]
        public string MarketingPaymentTermDescription
        {
            get { return this.marketingPaymentTermDescription; }
            set { ApplyPropertyChange<MarketingPaymentMaster, string>(ref this.marketingPaymentTermDescription, o => o.MarketingPaymentTermDescription, value); }
        }

        //[DefaultValue(0)]
        public int RequestedEmployeeID
        {
            get { return this.requestedEmployeeID; }
            set { ApplyPropertyChange<MarketingPaymentMaster, int>(ref this.requestedEmployeeID, o => o.RequestedEmployeeID, value); }
        }


        //[DefaultValue(0)]
        public int NotedEmployeeID
        {
            get { return this.notedEmployeeID; }
            set { ApplyPropertyChange<MarketingPaymentMaster, int>(ref this.notedEmployeeID, o => o.NotedEmployeeID, value); }
        }


        //[DefaultValue(0)]
        public int ApprovedEmployeeID
        {
            get { return this.approvedEmployeeID; }
            set { ApplyPropertyChange<MarketingPaymentMaster, int>(ref this.approvedEmployeeID, o => o.ApprovedEmployeeID, value); }
        }


        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime PaymentDate
        {
            get { return this.paymentDate; }
            set { ApplyPropertyChange<MarketingPaymentMaster, DateTime>(ref this.paymentDate, o => o.PaymentDate, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime EntryDate
        {
            get { return this.entryDate; }
            set { ApplyPropertyChange<MarketingPaymentMaster, DateTime>(ref this.entryDate, o => o.EntryDate, value); }
        }


        public string PaymentApplyTo
        {
            get { return this.MarketingProgramReference + (this.MarketingIncentivePeriod != "" ? " [" + this.MarketingIncentivePeriod + "]" : "") + (this.MarketingPaymentTermDescription != "" ? " [" + this.MarketingPaymentTermDescription + "]" : "") + (this.CustomerDescription != "" ? " [" + this.CustomerDescription + "]" : ""); }
        }


        #endregion


        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("MarketingIncentiveID", "Please select a command.", delegate { return this.MarketingIncentiveID > 0; }));
            validationRules.Add(new SimpleValidationRule("PaymentApplyTo", "Please select a command.", delegate { return this.MarketingProgramID > 0; }));
            validationRules.Add(new SimpleValidationRule("ReferenceCode", "Reference cannot be blank.", delegate { return this.ReferenceCode.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("RequestedEmployeeID", "Requested person cannot be empty.", delegate { return this.RequestedEmployeeID != 0; }));
            validationRules.Add(new SimpleValidationRule("NotedEmployeeID", "Noted person cannot be empty.", delegate { return this.NotedEmployeeID != 0; }));
            validationRules.Add(new SimpleValidationRule("ApprovedEmployeeID", "Approved person Name cannot be empty.", delegate { return this.ApprovedEmployeeID != 0; }));

            return validationRules;
        }

    }
}

